package com.itmayiedu.controller;

import com.itmayiedu.model.test.StudentMapper;
import com.itmayiedu.model.test.Student;
import com.itmayiedu.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by Devin on 2018/1/21.
 */
@RestController
public class JdbcController {

    @Autowired
    private UserService userService;

    @Autowired
    private StudentMapper studentMapper;

    @RequestMapping("/create")
    public String create(){
        userService.createUser();
        return "add success";
    }

    @ResponseBody
    @RequestMapping("/get")
    public Student getById(Integer id){
        return studentMapper.findById(id);
    }

}
